export default data => {
  const methodRef = ref(null)

  const register = methods => {
    methodRef.value = methods
    methodRef.value.initData(data)
  }

  const testMethod = val => {
    methodRef.value.testMethod(val)
  }

  const openDrawer = data => {
    methodRef.value.openDrawer(data)
  }

  const closeDrawer = () => {
    methodRef.value.closeDrawer()
  }

  const setOkButtonLoading = loading => {
    methodRef.value.setOkButtonLoading(loading)
  }

  const setLoading = loading => {
    methodRef.value.setLoading(loading)
  }

  return [register, { testMethod, openDrawer, closeDrawer, setOkButtonLoading, setLoading }]
}
